﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml;

namespace Common.XmlConfig
{
    public class BaseConfig
    {
        protected string _Key;
        protected ConfigGroup _ParentGroup;
        protected XmlNode _Node;

        /// <summary>
        /// 主键
        /// </summary>
        public string Key { get { return _Key; } }

        /// <summary>
        /// 文本
        /// </summary>
        public string Text { get; set; }

        /// <summary>
        /// XML路径
        /// </summary>
        internal string XmlPath { get; set; }

        /// <summary>
        /// 所属组
        /// </summary>
        public ConfigGroup ParentGroup { get { return _ParentGroup; } }

        /// <summary>
        /// 设置父分组
        /// </summary>
        /// <param name="parentgroup"></param>
        internal void SetParentGroup(ConfigGroup parentgroup)
        {
            this._ParentGroup = parentgroup;
        }

        /// <summary>
        /// 所有属性
        /// </summary>
        public XmlAttributeCollection Attrs { get { return Node.Attributes; } }

        /// <summary>
        /// Xml节点
        /// </summary>
        public XmlNode Node { get { return _Node; } }
    }
}
